<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::Adobe::FDF</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::Adobe::FDF</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/origami/parsers/fdf_rb.html">
                origami/parsers/fdf.rb
                </a>
        <br />
                <a href="../../../files/origami/adobe/fdf_rb.html">
                origami/adobe/fdf.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Class representing an AcroForm Forms Data Format file.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000319">&lt;&lt;</a>&nbsp;&nbsp;
      <a href="#M000320">Catalog</a>&nbsp;&nbsp;
      <a href="#M000318">append_subobj</a>&nbsp;&nbsp;
      <a href="#M000317">objects</a>&nbsp;&nbsp;
      <a href="#M000321">save</a>&nbsp;&nbsp;
      <a href="#M000322">saveas</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Class <a href="FDF/Header.html" class="link">Origami::Adobe::FDF::Header</a><br />
Class <a href="FDF/Parser.html" class="link">Origami::Adobe::FDF::Parser</a><br />
Class <a href="FDF/Revision.html" class="link">Origami::Adobe::FDF::Revision</a><br />

    </div>

    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">Size</td>
          <td>=</td>
          <td class="context-item-value">rev.body.size + 1</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">Size</td>
          <td>=</td>
          <td class="context-item-value">@revisions.first.body.size + 1</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">header</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">revisions</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000319" class="method-detail">
        <a name="M000319"></a>

        <div class="method-heading">
          <a href="#M000319" class="method-signature">
          <span class="method-name">&lt;&lt;</span><span class="method-args">(object)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000319-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000319-source">
<pre>
     <span class="ruby-comment cmt"># File origami/adobe/fdf.rb, line 132</span>
132:       <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">object</span>)
133:         
134:         <span class="ruby-identifier">object</span>.<span class="ruby-identifier">set_indirect</span>(<span class="ruby-keyword kw">true</span>)
135:         
136:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span>.<span class="ruby-identifier">zero?</span>
137:         <span class="ruby-identifier">maxno</span> = <span class="ruby-value">1</span>
138:           <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">get_object</span>(<span class="ruby-identifier">maxno</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">maxno</span> = <span class="ruby-identifier">maxno</span>.<span class="ruby-identifier">succ</span> <span class="ruby-keyword kw">end</span>
139:           
140:           <span class="ruby-identifier">object</span>.<span class="ruby-identifier">generation</span> = <span class="ruby-value">0</span>
141:           <span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span> = <span class="ruby-identifier">maxno</span>
142:         <span class="ruby-keyword kw">end</span>
143:         
144:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">reference</span>] = <span class="ruby-identifier">object</span>
145:         
146:         <span class="ruby-identifier">object</span>.<span class="ruby-identifier">reference</span>
147:       <span class="ruby-keyword kw">end</span>
148:       
149:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Catalog</span>
150:         <span class="ruby-identifier">get_object</span>(<span class="ruby-ivar">@trailer</span>.<span class="ruby-constant">Root</span>)
151:       <span class="ruby-keyword kw">end</span>
152:       
153:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">filename</span>)
154:         
155:         <span class="ruby-identifier">bin</span> = <span class="ruby-value str">&quot;&quot;</span>
156:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">to_s</span>
157: 
158:         <span class="ruby-identifier">lastno</span>, <span class="ruby-identifier">brange</span> = <span class="ruby-value">0</span>, <span class="ruby-value">0</span>
159:           
160:         <span class="ruby-identifier">xrefs</span> = [ <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">LASTFREE</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">FREE</span>) ]
161:         <span class="ruby-identifier">xrefsection</span> = <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Section</span>.<span class="ruby-identifier">new</span>
162:  
163:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
164:           <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">lastno</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
165:             <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
166:             <span class="ruby-identifier">brange</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span>
167:             <span class="ruby-identifier">xrefs</span>.<span class="ruby-identifier">clear</span>
168:           <span class="ruby-keyword kw">end</span>
169:           
170:           <span class="ruby-identifier">xrefs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bin</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">generation</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">USED</span>)
171:           <span class="ruby-identifier">lastno</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span>
172: 
173:           <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_s</span>
174:         }
175:         
176:         <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
177:         
178:         <span class="ruby-ivar">@xreftable</span> = <span class="ruby-identifier">xrefsection</span>
179:         <span class="ruby-ivar">@trailer</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Trailer</span>.<span class="ruby-identifier">new</span>
180:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-constant">Size</span> = <span class="ruby-identifier">rev</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
181:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-identifier">startxref</span> = <span class="ruby-identifier">bin</span>.<span class="ruby-identifier">size</span>
182: 
183:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@xreftable</span>.<span class="ruby-identifier">to_s</span>
184:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@trailer</span>.<span class="ruby-identifier">to_s</span>
185: 
186:         <span class="ruby-identifier">fd</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">&quot;w&quot;</span>).<span class="ruby-identifier">binmode</span>
187:           <span class="ruby-identifier">fd</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">bin</span> 
188:         <span class="ruby-identifier">fd</span>.<span class="ruby-identifier">close</span>
189:         
190:         <span class="ruby-identifier">show_entries</span>
191:       <span class="ruby-keyword kw">end</span>
192:       <span class="ruby-keyword kw">alias</span> <span class="ruby-identifier">saveas</span> <span class="ruby-identifier">save</span>
193:       
194:       <span class="ruby-identifier">private</span>
195:       
196:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rebuildxrefs</span> <span class="ruby-comment cmt">#:nodoc:</span>
197:         
198:         <span class="ruby-identifier">startxref</span> = <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>
199:         
200:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
201:           <span class="ruby-identifier">startxref</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>
202:         }
203:           
204:         <span class="ruby-ivar">@xreftable</span> = <span class="ruby-identifier">buildxrefs</span>(<span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>)
205:         
206:         <span class="ruby-ivar">@trailer</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Trailer</span>.<span class="ruby-identifier">new</span>
207:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-constant">Size</span> = <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
208:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-identifier">startxref</span> = <span class="ruby-identifier">startxref</span>
209:         
210:         <span class="ruby-keyword kw">self</span>
211:       <span class="ruby-keyword kw">end</span>
212:       
213:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">buildxrefs</span>(<span class="ruby-identifier">objects</span>) <span class="ruby-comment cmt">#:nodoc:</span>
214:         
215:         <span class="ruby-identifier">lastno</span> = <span class="ruby-value">0</span>
216:         <span class="ruby-identifier">brange</span> = <span class="ruby-value">0</span>
217:         
218:         <span class="ruby-identifier">xrefs</span> = [ <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">LASTFREE</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">FREE</span>) ]
219:         
220:         <span class="ruby-identifier">xrefsection</span> = <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Section</span>.<span class="ruby-identifier">new</span>
221:         <span class="ruby-identifier">objects</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
222:           <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">lastno</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
223:             <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
224:             <span class="ruby-identifier">brange</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span>
225:             <span class="ruby-identifier">xrefs</span>.<span class="ruby-identifier">clear</span>
226:           <span class="ruby-keyword kw">end</span>
227:           
228:           <span class="ruby-identifier">xrefs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">get_object_offset</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">generation</span>), <span class="ruby-identifier">object</span>.<span class="ruby-identifier">generation</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">USED</span>)
229: 
230:           <span class="ruby-identifier">lastno</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span>
231:         }
232:         
233:         <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
234:         
235:         <span class="ruby-identifier">xrefsection</span>
236:       <span class="ruby-keyword kw">end</span>
237:      
238:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_object_offset</span>(<span class="ruby-identifier">no</span>,<span class="ruby-identifier">generation</span>) <span class="ruby-comment cmt">#:nodoc:</span>
239: 
240:         <span class="ruby-identifier">bodyoffset</span> = <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>
241:         
242:         <span class="ruby-identifier">objectoffset</span> = <span class="ruby-identifier">bodyoffset</span>
243:           
244:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
245:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">no</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">no</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">generation</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">generation</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">objectoffset</span>
246:           <span class="ruby-keyword kw">else</span>
247:             <span class="ruby-identifier">objectoffset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>
248:           <span class="ruby-keyword kw">end</span>
249:         }
250:         
251:         <span class="ruby-keyword kw">nil</span>
252:       <span class="ruby-keyword kw">end</span>
253:       
254:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000320" class="method-detail">
        <a name="M000320"></a>

        <div class="method-heading">
          <a href="#M000320" class="method-signature">
          <span class="method-name">Catalog</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000320-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000320-source">
<pre>
     <span class="ruby-comment cmt"># File origami/adobe/fdf.rb, line 149</span>
149:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Catalog</span>
150:         <span class="ruby-identifier">get_object</span>(<span class="ruby-ivar">@trailer</span>.<span class="ruby-constant">Root</span>)
151:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000318" class="method-detail">
        <a name="M000318"></a>

        <div class="method-heading">
          <a href="#M000318" class="method-signature">
          <span class="method-name">append_subobj</span><span class="method-args">(root, objset)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000318-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000318-source">
<pre>
     <span class="ruby-comment cmt"># File origami/adobe/fdf.rb, line 113</span>
113:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_subobj</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">objset</span>)
114:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">objset</span>.<span class="ruby-identifier">find</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">object_id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">object_id</span> }.<span class="ruby-identifier">nil?</span>
115:             <span class="ruby-identifier">objset</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">root</span>
116:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Dictionary</span>)
117:               <span class="ruby-identifier">root</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">subobj</span><span class="ruby-operator">|</span> <span class="ruby-identifier">append_subobj</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">objset</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">subobj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Reference</span>) }
118:             <span class="ruby-keyword kw">end</span>
119:           <span class="ruby-keyword kw">end</span>
120:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000317" class="method-detail">
        <a name="M000317"></a>

        <div class="method-heading">
          <a href="#M000317" class="method-signature">
          <span class="method-name">objects</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000317-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000317-source">
<pre>
     <span class="ruby-comment cmt"># File origami/adobe/fdf.rb, line 112</span>
112:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">objects</span>
113:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_subobj</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">objset</span>)
114:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">objset</span>.<span class="ruby-identifier">find</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">object_id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">object_id</span> }.<span class="ruby-identifier">nil?</span>
115:             <span class="ruby-identifier">objset</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">root</span>
116:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Dictionary</span>)
117:               <span class="ruby-identifier">root</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">subobj</span><span class="ruby-operator">|</span> <span class="ruby-identifier">append_subobj</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">objset</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">subobj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Reference</span>) }
118:             <span class="ruby-keyword kw">end</span>
119:           <span class="ruby-keyword kw">end</span>
120:         <span class="ruby-keyword kw">end</span>
121:         
122:         <span class="ruby-identifier">objset</span> = []
123:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
124:           <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Reference</span>)
125:             <span class="ruby-identifier">append_subobj</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">objset</span>)
126:           <span class="ruby-keyword kw">end</span>
127:         <span class="ruby-keyword kw">end</span>
128:         
129:         <span class="ruby-identifier">objset</span>
130:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000321" class="method-detail">
        <a name="M000321"></a>

        <div class="method-heading">
          <a href="#M000321" class="method-signature">
          <span class="method-name">save</span><span class="method-args">(filename)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000321-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000321-source">
<pre>
     <span class="ruby-comment cmt"># File origami/adobe/fdf.rb, line 153</span>
153:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">filename</span>)
154:         
155:         <span class="ruby-identifier">bin</span> = <span class="ruby-value str">&quot;&quot;</span>
156:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">to_s</span>
157: 
158:         <span class="ruby-identifier">lastno</span>, <span class="ruby-identifier">brange</span> = <span class="ruby-value">0</span>, <span class="ruby-value">0</span>
159:           
160:         <span class="ruby-identifier">xrefs</span> = [ <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">LASTFREE</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">FREE</span>) ]
161:         <span class="ruby-identifier">xrefsection</span> = <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Section</span>.<span class="ruby-identifier">new</span>
162:  
163:         <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
164:           <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">lastno</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
165:             <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
166:             <span class="ruby-identifier">brange</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span>
167:             <span class="ruby-identifier">xrefs</span>.<span class="ruby-identifier">clear</span>
168:           <span class="ruby-keyword kw">end</span>
169:           
170:           <span class="ruby-identifier">xrefs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bin</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">generation</span>, <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">USED</span>)
171:           <span class="ruby-identifier">lastno</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span>
172: 
173:           <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_s</span>
174:         }
175:         
176:         <span class="ruby-identifier">xrefsection</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XRef</span><span class="ruby-operator">::</span><span class="ruby-constant">Subsection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">xrefs</span>)
177:         
178:         <span class="ruby-ivar">@xreftable</span> = <span class="ruby-identifier">xrefsection</span>
179:         <span class="ruby-ivar">@trailer</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Trailer</span>.<span class="ruby-identifier">new</span>
180:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-constant">Size</span> = <span class="ruby-identifier">rev</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
181:         <span class="ruby-ivar">@trailer</span>.<span class="ruby-identifier">startxref</span> = <span class="ruby-identifier">bin</span>.<span class="ruby-identifier">size</span>
182: 
183:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@xreftable</span>.<span class="ruby-identifier">to_s</span>
184:         <span class="ruby-identifier">bin</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@trailer</span>.<span class="ruby-identifier">to_s</span>
185: 
186:         <span class="ruby-identifier">fd</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">&quot;w&quot;</span>).<span class="ruby-identifier">binmode</span>
187:           <span class="ruby-identifier">fd</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">bin</span> 
188:         <span class="ruby-identifier">fd</span>.<span class="ruby-identifier">close</span>
189:         
190:         <span class="ruby-identifier">show_entries</span>
191:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000322" class="method-detail">
        <a name="M000322"></a>

        <div class="method-heading">
          <span class="method-name">saveas</span><span class="method-args">(filename)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="FDF.html#M000321">save</a>
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>